import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class StuMSbox extends JFrame {
	private JLabel mlabel;
	private JMenuBar mainmenu;
	private JMenu system, student, course, xuanke;
	private JMenuItem system_login, system_adduser,system_exit;
	private JMenuItem student_add,student_search,student_modify,student_del;
	private JMenuItem course_add, course_search,course_modify,course_del;
	private JMenuItem xuanke_add, xuanke_search,xuanke_modify,xuanke_del;

	private Adduser frma = new Adduser(this, "添加用户");
	private Loginfrm frml = new Loginfrm(this,"用户登录");
	private StuMSbox() {
		super("学生管理信息系统");
		Font myFont = new Font("楷体_GB2312", Font.BOLD, 60);
		mlabel = new JLabel("       学生管理信息系统");
		mlabel.setFont(myFont);
		add(mlabel);

		mainmenu = new JMenuBar();

		system = new JMenu("系统管理");
		student = new JMenu("学生管理");
		course = new JMenu("课程管理");
		xuanke = new JMenu("选课管理");
		
		mainmenu.add(system);
		mainmenu.add(student);
		mainmenu.add(course);
		mainmenu.add(xuanke);
		
		system_login = new JMenuItem("用户登录");
		system_adduser = new JMenuItem("添加用户");
		system_exit = new JMenuItem("退出");
		system.add(system_login);
		system.add(system_adduser);
		system.add(system_exit);
		
		student_add = new JMenuItem("学生添加");
		student_search = new  JMenuItem("学生查询");
		student_modify = new JMenuItem("学生修改");
		student_del = new JMenuItem("学生删除");
		student.add(student_add);
		student.add(student_search);
		student.add(student_modify);
		student.add(student_del);
		
		course_add = new JMenuItem("课程添加");
		course_search = new  JMenuItem("课程查询");
		course_modify = new JMenuItem("课程修改");
		course_del = new JMenuItem("课程删除");
		course.add(course_add);
		course.add(course_search);
		course.add(course_modify);
		course.add(course_del);
		
		xuanke_add = new JMenuItem("选课添加");
		xuanke_search = new  JMenuItem("选课查询");
		xuanke_modify = new JMenuItem("选课修改");
		xuanke_del = new JMenuItem("选课删除");
		xuanke.add(xuanke_add);
		xuanke.add(xuanke_search);
		xuanke.add(xuanke_modify);
		xuanke.add(xuanke_del);
		
		system_login.addActionListener(listener);
		system_adduser.addActionListener(listener);
		system_exit.addActionListener(listener);
		
		
		student_add.addActionListener(listener);
		student_search.addActionListener(listener);
		student_modify.addActionListener(listener);
		student_del.addActionListener(listener);
		

		course_add.addActionListener(listener);
		course_search.addActionListener(listener);
		course_modify.addActionListener(listener);
		course_del.addActionListener(listener);
		
		xuanke_add.addActionListener(listener);
		xuanke_search.addActionListener(listener);
		xuanke_modify.addActionListener(listener);
		xuanke_del.addActionListener(listener);
		
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setJMenuBar(mainmenu);
		setBounds(150, 60, 800, 600);
		this.setVisible(true);
	}
	private ActionListener listener = new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			if (e.getActionCommand() == "退出") {
				System.exit(0);
			} else if (e.getActionCommand() == "添加用户") {
				frma.setVisible(true);
			} else if (e.getActionCommand() == "用户登录") {
				frml.setVisible(true);
			}
		}
	};
	public static void main(String[] args) {
		StuMSbox mbox = new StuMSbox();
	}
}
